<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>Web高级开发 | Advanced Web Development Course</title>
    <link
      href="https://fonts.googleapis.com/css?family=Heebo:300,400"
      rel="stylesheet"
    />
    <link rel="stylesheet" href="../../css/main.css" />
    <link rel="stylesheet" href="../../css/tabs.css" />
    <script src="../../js/uikit.js"></script>
  </head>

  <body>
    <div
      data-uk-sticky="animation: uk-animation-slide-top; sel-target: .uk-navbar-container; cls-active: uk-navbar-sticky; cls-inactive: uk-navbar-transparent; top: 300"
    >
      <nav class="uk-navbar-container pt-2 pb-2">
        <div class="uk-container">
          <div data-uk-navbar>
            <div class="uk-navbar-left">
              <a
                class="uk-navbar-item uk-logo uk-visible@m"
                href="../../index.html"
                >Web高级开发课程</a
              >
              <a
                class="uk-navbar-tuk-containeroggle uk-hidden@m"
                href="#offcanvas-docs"
                data-uk-toggle
                ><span data-uk-navbar-toggle-icon></span>
                <span class="uk-margin-small-left">目录</span></a
              >
              <ul class="uk-navbar-nav uk-visible@m">
                <li><a href="../../index.html">文档</a></li>
              </ul>
            </div>
            <div class="uk-navbar-center uk-hidden@m">
              <a class="uk-navbar-item uk-logo" href="../../index.html"
                >Web高级开发课程</a
              >
            </div>
          </div>
        </div>
      </nav>
    </div>

    <div class="uk-section">
      <div class="uk-container">
        <div class="uk-grid-large" data-uk-grid>
          <div class="sidebar-fixed-width uk-visible@m">
            <div class="sidebar-docs uk-position-fixed uk-margin-top">
              <h5>关于这门课</h5>
              <ul class="uk-nav uk-nav-default doc-nav">
                <li><a href="../../index.html">大纲</a></li>
              </ul>
              <h5>章节</h5>
              <ul class="uk-nav uk-nav-default doc-nav">
                <li><a href="../01.html">第1章 - Spring基础</a></li>
                <li><a href="../02.html">第2章 - Spring中的Bean</a></li>
                <li><a href="../03.html">第3章 - Spring AOP</a></li>
                <li><a href="../04.html">第4章 - Spring的事物管理</a></li>
                <li><a href="../05.html">第5章 - 初识MyBatis</a></li>
                <li><a href="../06.html">第6章 - MyBatis的核心配置</a></li>
                <li><a href="../07.html">第7章 - MyBatis的高级应用</a></li>
                <li><a href="../08.html">第8章 - Spring MVC入门</a></li>
                <li><a href="../09.html">第9章 - Spring MVC数据绑定</a></li>
                <li><a href="../10.html">第10章 - Spring MVC拦截器</a></li>
                <li><a href="../11.html">第11章 - Spring Boot基础</a></li>
                <li><a href="../12.html">第12章 - Spring Boot的Web开发</a></li>
                <li>
                  <a href="../13.html">第13章 - Spring Boot的数据库连接</a>
                </li>
                <li><a href="../14.html">第14章 - 框架整合</a></li>
              </ul>
              <h5>实验课</h5>
              <ul class="uk-nav uk-nav-default doc-nav">
                <li><a href="./code-01.html">01</a></li>
                <li class="uk-active"><a href="./code-02.html">02</a></li>
                <li><a href="./code-03.html">03</a></li>
                <li><a href="./code-04.html">04</a></li>
                <li><a href="./code-05.html">05</a></li>
                <li><a href="./code-06.html">06</a></li>
                <li><a href="./code-07.html">07</a></li>
                <li><a href="./code-08.html">08</a></li>
                <li><a href="./code-09.html">09</a></li>
                <li><a href="./code-10.html">10</a></li>
                <li><a href="./code-11.html">11</a></li>
                <li><a href="./code-12.html">12</a></li>
              </ul>
            </div>
          </div>
          <div class="uk-width-1-1 uk-width-expand@m">
            <article class="uk-article">
              <h3>AOP实验课内容</h3>
              <div class="tabs">
                <div class="tab-2">
                  <label for="tab2-1">xml方式</label>
                  <input
                    id="tab2-1"
                    name="tabs-three"
                    type="radio"
                    checked="checked"
                  />
                  <div>
                    <p>
                      0. 更新pom.xml文件，告诉Maven咱们需要加个包
                      <br><br>
                      <img src="../../images/lab02/pom-1.JPG" alt="pom-1" />
                      <br><br>
                      右键项目，Maven --> Update Project 更新项目
                      <br><br>
                      <img src="../../images/lab02/pom-2.JPG" alt="pom-2" />
                    </p>
                    <p>
                      1. 创建UserDao Interface
                      <br /><br />
                      <img src="../../images/lab02/xml-1.JPG" alt="xml-1" />
                    </p>
                    <p>
                      2.
                      创建UserDao实现类，我们的目的是对saveUser方法进行增强/通知
                      <br /><br />
                      <img src="../../images/lab02/xml-2.JPG" alt="xml-2" />
                    </p>
                    <p>
                      3. 创建切面类
                      <br /><br />
                      <img src="../../images/lab02/xml-3.JPG" alt="xml-3" />
                    </p>
                    <p>
                      4. 配置xml文件，xml配置模板文件可<a href="../../files/applicationContext.xml" download>戳这里</a>下载
                      <br /><br />
                      <img src="../../images/lab02/xml-4.JPG" alt="xml-4" />
                    </p>
                    <p>
                      5. 跑一波
                      <br /><br />
                      <img src="../../images/lab02/xml-5.JPG" alt="xml-5" />
                    </p>
                    <p>6. 尝试更改xml配置文件为saveUser方法添加其它增强方法</p>
                  </div>
                </div>
                <div class="tab-2">
                  <label for="tab2-2">Annotation(注解)方式</label>
                  <input id="tab2-2" name="tabs-three" type="radio" />
                  <div>
                    <p>
                      1. 还是同样的UserDao Interface
                      <br /><br />
                      <img src="../../images/lab02/xml-1.JPG" alt="xml-1" />
                    </p>
                    <p>
                      2.创建UserDao实现类。
                      <br />
                      注意添加@Component注解
                      <br />
                      为了提高可读性，这里的@Component可以用@Repository替换
                      <br /><br />
                      <img src="../../images/lab02/anno-2.JPG" alt="anno-2" />
                    </p>
                    <p>
                      3. 创建切面类
                      <br />
                      注意添加@Aspect注解，让Spring知道这是个切面
                      <br />
                      注意添加@Component注解
                      <br /><br />
                      <img src="../../images/lab02/anno-3.JPG" alt="anno-3" />
                    </p>
                    <p>
                      4. 配置xml文件
                      <br /><br />
                      <img src="../../images/lab02/anno-4.JPG" alt="anno-4" />
                    </p>
                    <p>
                      5. 跑一波
                      <br /><br />
                      <img src="../../images/lab02/anno-5.JPG" alt="anno-5" />
                    </p>
                    <p>6. 尝试添加其它注解为saveUser方法添加其它增强方法</p>
                  </div>
                </div>
              </div>
            </article>
          </div>
        </div>
      </div>
    </div>

    <div id="offcanvas-docs" data-uk-offcanvas="overlay: true">
      <div class="uk-offcanvas-bar">
        <button class="uk-offcanvas-close" type="button" data-uk-close></button>
        <h5 class="uk-margin-top">关于这门课</h5>
        <ul class="uk-nav uk-nav-default doc-nav">
          <li><a href="../indext.html">大纲</a></li>
        </ul>
        <h5 class="uk-margin-top">章节</h5>
        <ul class="uk-nav uk-nav-default doc-nav">
          <li><a href="../01.html">第1章 - Spring基础</a></li>
          <li><a href="../02.html">第2章 - Spring中的Bean</a></li>
          <li><a href="../03.html">第3章 - Spring AOP</a></li>
          <li><a href="../04.html">第4章 - Spring的事物管理</a></li>
          <li><a href="../05.html">第5章 - 初识MyBatis</a></li>
          <li><a href="../06.html">第6章 - MyBatis的核心配置</a></li>
          <li><a href="../07.html">第7章 - MyBatis的高级应用</a></li>
          <li><a href="../08.html">第8章 - Spring MVC入门</a></li>
          <li><a href="../09.html">第9章 - Spring MVC数据绑定</a></li>
          <li><a href="../10.html">第10章 - Spring MVC拦截器</a></li>
          <li><a href="../11.html">第11章 - Spring Boot基础</a></li>
          <li><a href="../12.html">第12章 - Spring Boot的Web开发</a></li>
          <li><a href="../13.html">第13章 - Spring Boot的数据库连接</a></li>
          <li><a href="../14.html">第14章 - 框架整合</a></li>
        </ul>
        <h5>实验课</h5>
        <ul class="uk-nav uk-nav-default doc-nav">
          <li><a href="./code-01.html">01</a></li>
          <li class="uk-active"><a href="./code-02.html">02</a></li>
          <li><a href="./code-03.html">03</a></li>
          <li><a href="./code-04.html">04</a></li>
          <li><a href="./code-05.html">05</a></li>
          <li><a href="./code-06.html">06</a></li>
          <li><a href="./code-07.html">07</a></li>
          <li><a href="./code-08.html">08</a></li>
          <li><a href="./code-09.html">09</a></li>
          <li><a href="./code-10.html">10</a></li>
          <li><a href="./code-11.html">11</a></li>
          <li><a href="./code-12.html">12</a></li>
        </ul>
      </div>
    </div>

    <footer class="uk-section uk-text-center uk-text-muted">
      <div class="uk-container uk-container-small">
        <div class="uk-margin-medium"></div>
      </div>
    </footer>

    <script src="../js/awesomplete.js"></script>
    <script src="../js/custom.js"></script>
  </body>
</html>
